package org.example.actualcombat.demos.web.modules.pms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.actualcombat.demos.web.modules.pms.mapper.PmsBrandMapper;
import org.example.actualcombat.demos.web.modules.pms.model.PmsBrand;
import org.example.actualcombat.demos.web.modules.pms.service.PmsBrandService;
import org.springframework.stereotype.Service;

@Service
public class PmsBrandServiceImpl extends ServiceImpl<PmsBrandMapper,PmsBrand> implements PmsBrandService {
    @Override
    public Page<PmsBrand> list(String keyword, Integer pageNum, Integer pageSize) {
        Page<PmsBrand> page = new Page<>(pageNum,pageSize);
        LambdaQueryWrapper<PmsBrand> wrapper = new QueryWrapper<PmsBrand>().lambda().like(PmsBrand::getName, keyword);
        wrapper.orderByAsc(PmsBrand::getSort);
        return this.page(page, wrapper);
    }
}
